//
//  MainWin.m
//  HealthAsk
//
//  Created by liyuhang on 12-8-19.
//  Copyright 2012年 __MyCompanyName__. All rights reserved.
//

#import "MainWin.h"
#import "WinHelp.h"
#import "WinOption.h"
#import "HelloWorldLayer.h"


@implementation MainWin

+(CCScene *) scene
{
	// 'scene' is an autorelease object.
	CCScene *scene = [CCScene node];
	
	// 'layer' is an autorelease object.
	MainWin *layer = [MainWin node];
	
	// add layer as a child to scene
	[scene addChild: layer];
    
  	// return the scene
	return scene;
}
-(id) init
{
	// always call "super" init
	// Apple recommends to re-assign "self" with the "super's" return value
	if( (self=[super init]) ) {
        // Add the menu to the layer
        NSString * _AppName = @"健康教育委员会";
        m_pLabel = [CCLabelTTF labelWithString:_AppName fontName:@"Marker Felt" fontSize:40];
        
        // ask director for the window size
        CGSize size = [[CCDirector sharedDirector] winSize];
        
        // position the label on the center of the screen
        m_pLabel.position =  ccp( size.width/2 , 4*size.height/5  );
        [self addChild: m_pLabel];
        
        NSString * _pSelgameStart = @"大百科";
        CCMenuItem *_itemSel1 = [CCMenuItemFont itemWithString:_pSelgameStart block:^(id sender) {
           [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[HelloWorldLayer scene] withColor:ccWHITE]];
        }];
        [_itemSel1 setPosition:ccp(0,1*size.height/10)];
        NSString * _pSelgameOption = @"设置";
        CCMenuItem *_itemSel2 = [CCMenuItemFont itemWithString:_pSelgameOption block:^(id sender) {
            [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[WinOption scene] withColor:ccWHITE]];
        }];
        [_itemSel2 setPosition:ccp(0,0)];
        NSString * _pSelgameHelp = @"帮助";
        CCMenuItem *_itemSel3 = [CCMenuItemFont itemWithString:_pSelgameHelp block:^(id sender) {
            [[CCDirector sharedDirector] replaceScene:[CCTransitionFade transitionWithDuration:1.0 scene:[WinHelp scene] withColor:ccWHITE]];
        }];
        [_itemSel3 setPosition:ccp(0,-1*size.height/10)];
        NSString * _pSelgameShop = @"商店";
        CCMenuItem *_itemSel4 = [CCMenuItemFont itemWithString:_pSelgameShop block:^(id sender) {
            
        }];
        [_itemSel4 setPosition:ccp(0,-2*size.height/10)];        // Leaderboard Menu Item using blocks
        
        m_pMenu = [CCMenu menuWithItems:_itemSel1, _itemSel2, _itemSel3, _itemSel4, nil];
		[self addChild:m_pMenu];
        //  [self scheduleUpdate];
	}
	return self;
}
@end
